package cn.huq.day02

import org.apache.spark.rdd.RDD
import org.apache.spark.{SparkConf, SparkContext}

class MapDemo {
  def main(args: Array[String]): Unit = {
    val sc: SparkContext = new SparkContext(config = new SparkConf().setAppName("map demo").setMaster("local"))

    val dataRDD = sc.textFile(args(0))

    val rdd1: RDD[Int] = dataRDD.map(_.toInt)

    val rdd2: RDD[Int] = rdd1.filter(_ % 2 == 0)

    val rdd3: RDD[Int] = rdd2.map(_ * 10)

    rdd3.saveAsTextFile(args(1))

    sc.stop()
  }

}
